home *** CD-ROM | disk | FTP | other *** search
/ PC Basics 53 / PC Basics Issue 53.iso / Software / Internet / Invboard.exe / PC Basics 53 / Invboard / upload / sources / Boards.php next >
Encoding:
PHP Script  |  2002-08-01  |  21.6 KB  |  709 lines

  1. <?php
  2.  
  3. /*
  4. +--------------------------------------------------------------------------
  5. |   IBFORUMS v1
  6. |   ========================================
  7. |   by Matthew Mecham and David Baxter
  8. |   (c) 2001,2002 IBForums
  9. |   http://www.ibforums.com
  10. |   ========================================
  11. |   Web: http://www.ibforums.com
  12. |   Email: phpboards@ibforums.com
  13. |   Licence Info: phpib-licence@ibforums.com
  14. +---------------------------------------------------------------------------
  15. |
  16. |   > Board index module
  17. |   > Module written by Matt Mecham
  18. |   > Date started: 17th February 2002
  19. |
  20. |    > Module Version Number: 1.0.0
  21. +--------------------------------------------------------------------------
  22. */
  23.  
  24.  
  25. $idx = new Boards;
  26.  
  27. class Boards {
  28.  
  29.     var $output   = "";
  30.     var $base_url = "";
  31.     var $html     = "";
  32.     var $output   = "";
  33.     var $forums   = array();
  34.     var $mods     = array();
  35.     var $cats     = array();
  36.     var $children = array();
  37.     var $nav;
  38.     
  39.     var $news_topic_id = "";
  40.     var $news_forum_id = "";
  41.     var $news_title    = "";
  42.     
  43.     function Boards() {
  44.         global $ibforums, $DB, $std, $print, $skin_universal;
  45.         
  46.         require "./Skin/".$ibforums->skin_id."/skin_boards.php";
  47.         
  48.         $this->base_url = "{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}";
  49.  
  50.         // Get more words for this invocation!
  51.         $ibforums->lang = $std->load_words($ibforums->lang, 'lang_boards', $ibforums->lang_id);
  52.  
  53.         $this->html     = new skin_boards();
  54.         
  55.         if (! $ibforums->member['id'] )
  56.         {
  57.             $ibforums->input['last_visit'] = time();
  58.         }
  59.         
  60.         $this->output .= $this->html->PageTop( $std->get_date( $ibforums->input['last_visit'], 'LONG' ) );
  61.         
  62.         // Get the forums and category info from the DB
  63.         
  64.         $last_c_id = -1;
  65.         
  66.         $DB->query("SELECT f.*, c.id as cat_id, c.position as cat_position, c.state as cat_state, c.name as cat_name, c.description as cat_desc, ".
  67.                    "c.image, c.url from ibf_forums f, ibf_categories c order by c.position, f.position");
  68.                    
  69.                    
  70.         while ( $r = $DB->fetch_row() )
  71.         {
  72.             if ($last_c_id != $r['cat_id'])
  73.             {
  74.                 $this->cats[ $r['cat_id'] ] = array( 'id'          => $r['cat_id'],
  75.                                                      'position'    => $r['cat_position'],
  76.                                                      'state'       => $r['cat_state'],
  77.                                                      'name'        => $r['cat_name'],
  78.                                                      'description' => $r['cat_desc'],
  79.                                                      'image'       => $r['image'],
  80.                                                      'url'         => $r['url'],
  81.                                                    );
  82.                                                    
  83.                 $last_c_id = $r['cat_id'];
  84.             }
  85.             
  86.             if ($r['parent_id'] > 0)
  87.             {
  88.                 $this->children[ $r['parent_id'] ][$r['id']] = $r;
  89.             }
  90.             else
  91.             {
  92.                 $this->forums[ $r['id'] ] = $r;
  93.             }
  94.         }
  95.         
  96.         $DB->query("SELECT forum_id, member_name, member_id FROM ibf_moderators");
  97.         
  98.         while ( $mod = $DB->fetch_row() )
  99.         {
  100.             $this->mods[ $mod['forum_id'] ][] = array( 'name' => $mod['member_name'],
  101.                                                        'id'   => $mod['member_id'],
  102.                                                      );
  103.         }
  104.         
  105.         //-----------------------------------
  106.         // What are we doing?
  107.         //-----------------------------------
  108.         
  109.         if ($ibforums->input['c'] != "")
  110.         {
  111.             $this->show_single_cat();
  112.             $this->nav[] = $this->cats[ $ibforums->input['c'] ]['name'];
  113.         }
  114.         else if ($ibforums->input['sub'] == 1)
  115.         {
  116.             $this->show_subforum();
  117.             $this->nav[] = $this->forums[ $ibforums->input['f'] ]['name'];
  118.         }
  119.         else
  120.         {
  121.             $this->process_all_cats();
  122.         }
  123.         
  124.         //*********************************************/
  125.         // Add in show online users
  126.         //*********************************************/
  127.         
  128.         $active = array( 'TOTAL'   => 0 ,
  129.                          'NAMES'   => "",
  130.                          'GUESTS'  => 0 ,
  131.                          'MEMBERS' => 0 ,
  132.                          'ANON'    => 0 ,
  133.                        );
  134.                        
  135.         $stats_html = "";
  136.         
  137.         if ($ibforums->vars['show_active'])
  138.         {
  139.         
  140.             // Get the users from the DB
  141.             
  142.             $time = time() - 900;
  143.             
  144.             $DB->query("SELECT s.member_id, s.member_name, s.login_type, g.suffix, g.prefix FROM ibf_sessions s, ibf_groups g WHERE running_time > '$time' AND g.g_id=s.member_group ORDER BY running_time DESC");
  145.             
  146.             // cache all printed members so we don't double print them
  147.             $cached = array();
  148.             while ($result = $DB->fetch_row() )
  149.             {
  150.                 if ($result['member_id'] == 0)
  151.                 {
  152.                     $active['GUESTS']++;
  153.                 }
  154.                 else
  155.                 {
  156.                     if (empty( $cached[ $result['member_id'] ] ) )
  157.                     {
  158.                         $cached[ $result['member_id'] ] = 1;
  159.                         if ($result['login_type'] == 1)
  160.                         {
  161.                             $active['ANON']++;
  162.                         }
  163.                         else
  164.                         {
  165.                             $active['MEMBERS']++;
  166.                             $active['NAMES'] .= " <span id='highlight'>></span><a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}&act=Profile&MID={$result['member_id']}'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>";
  167.                         }
  168.                     }
  169.                     
  170.                 }
  171.             }
  172.             
  173.             $active['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON'];
  174.             
  175.             // Show a link?
  176.             
  177.             if ($ibforums->vars['allow_online_list'])
  178.             {
  179.                 $active['LINK'] = '[ '."<a href='".$this->base_url."&act=Online&CODE=listall'>".$ibforums->lang['browser_user_list']."</a>".' ]';
  180.             }
  181.             
  182.             $stats_html .= $this->html->ActiveUsers($active);
  183.             
  184.             
  185.             //-----------------------------------------------
  186.             // Are we viewing the calendar?
  187.             //-----------------------------------------------
  188.             
  189.             if ($ibforums->vars['show_birthdays'])
  190.             {
  191.             
  192.                 $user_time = time() + ($ibforums->vars['TIME_ZONE'] * 3600) + ($ibforums->member['TIME_ADJUST'] * 3600 );
  193.                 
  194.                 $date = getdate($user_time);
  195.                 
  196.                 $day   = $date['mday'];
  197.                 $month = $date['mon'];
  198.                 $year  = $date['year'];
  199.                 
  200.                 $birthstring = "";
  201.                 $count       = 0;
  202.                 
  203.                 $DB->query("SELECT id, name, bday_day as DAY, bday_month as MONTH, bday_year as YEAR from ibf_members WHERE bday_day='$day' and bday_month='$month'");
  204.                 
  205.                 while ($user = $DB->fetch_row())
  206.                 {
  207.                     $birthstring .= "<span id='highlight'>></span><a href='{$this->base_url}&act=Profile&CODE=03&MID={$user['id']}'>{$user['name']}</a> ";
  208.                     if ($user['YEAR'])
  209.                     {
  210.                         $pyear = $year - $user['YEAR'];  // $year = 2002 and $user['YEAR'] = 1976
  211.                         $birthstring .= "(<b>$pyear</b>) ";
  212.                     }
  213.                     $count++;
  214.                 }
  215.                 
  216.                 $lang = $ibforums->lang['no_birth_users'];
  217.                 
  218.                 if ($count > 0) {
  219.                     $lang = ($count > 1) ? $ibforums->lang['birth_users'] : $ibforums->lang['birth_user'];
  220.                 }
  221.                 else
  222.                 {
  223.                     $count = "";
  224.                 }
  225.                 
  226.                 $stats_html .= $this->html->birthdays( $birthstring, $count, $lang  );
  227.             }
  228.                 
  229.         }
  230.         
  231.         //*********************************************/
  232.         // Add in show stats
  233.         //*********************************************/
  234.         
  235.         
  236.         if ($ibforums->vars['show_totals'])
  237.         {
  238.         
  239.             $DB->query("SELECT * FROM ibf_stats");
  240.             $stats = $DB->fetch_row();
  241.             
  242.             // Update the most active count if needed
  243.             
  244.             if ($active['TOTAL'] > $stats['MOST_COUNT'])
  245.             {
  246.                 $DB->query("UPDATE ibf_stats SET MOST_DATE='".time()."', MOST_COUNT='".$active[TOTAL]."'");
  247.                 $stats['MOST_COUNT'] = $active[TOTAL];
  248.                 $stats['MOST_DATE']  = time();
  249.             }
  250.             
  251.             $most_time = $std->get_date( $stats['MOST_DATE'], 'LONG' );
  252.             
  253.             $ibforums->lang['most_online'] = preg_replace( "/<#NUM#>/" ,   $stats['MOST_COUNT']  , $ibforums->lang['most_online'] );
  254.             $ibforums->lang['most_online'] = preg_replace( "/<#DATE#>/",   $most_time            , $ibforums->lang['most_online'] );
  255.             
  256.             $total_posts = $stats['TOTAL_REPLIES']+$stats['TOTAL_TOPICS'];
  257.             
  258.             $ibforums->lang['total_word_string'] = preg_replace( "/<#posts#>/" , "$total_posts"          , $ibforums->lang['total_word_string'] );
  259.             $ibforums->lang['total_word_string'] = preg_replace( "/<#reg#>/"   , $stats['MEM_COUNT']     , $ibforums->lang['total_word_string'] );
  260.             $ibforums->lang['total_word_string'] = preg_replace( "/<#mem#>/"   , $stats['LAST_MEM_NAME'] , $ibforums->lang['total_word_string'] );
  261.             
  262.             $stats_html .= $this->html->ShowStats($ibforums->lang['total_word_string']);
  263.             
  264.         }
  265.         
  266.         if ($stats_html != "")
  267.         {
  268.             $this->output .= $this->html->stats_header();
  269.             $this->output .= $stats_html;
  270.             $this->output .= $this->html->stats_footer();
  271.         }
  272.         
  273.         
  274.         // Add in board info footer
  275.         $this->output .= $this->html->BoardInformation();
  276.         
  277.         // Check for news forum.
  278.         
  279.         if ($this->news_title and $this->news_topic_id and $this->news_forum_id)
  280.         {
  281.             $t_html = $this->html->newslink( $this->news_forum_id, stripslashes($this->news_title) , $this->news_topic_id);
  282.             $this->output = preg_replace( "/<!-- IBF\.NEWSLINK -->/" , "$t_html" , $this->output );
  283.         }
  284.  
  285.         $print->add_output("$this->output");
  286.         $print->do_output( array( 'TITLE' => $ibforums->vars['board_name']." (Powered by Invision Board)", 'JS' => 0, 'NAV' => $this->nav ) );
  287.         
  288.     }
  289.     
  290.     //*********************************************/
  291.     //
  292.     // SHOW A SUB FORUM
  293.     //
  294.     //*********************************************/   
  295.     
  296.     function show_subforum() {
  297.     
  298.         global $std, $DB, $ibforums;    
  299.         
  300.         $fid = $ibforums->input['f'];
  301.         
  302.         if (!is_array( $this->forums[ $fid ] ) )
  303.         {
  304.             $std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
  305.         }
  306.         
  307.         if ( (isset($this->children[ $fid ])) and (count($this->children[ $fid ]) > 0 ) )
  308.         {
  309.             foreach ($this->children[ $fid ] as $idx => $data)
  310.             {
  311.                 $temp_html .= $this->process_forum($data['id'], $data);
  312.             }
  313.         }
  314.         else
  315.         {
  316.             $std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
  317.         }
  318.  
  319.         if ($temp_html != "")
  320.         {
  321.             $this->output .= $this->html->subheader();
  322.             $this->output .= $temp_html;
  323.             $this->output .= $this->html->end_this_cat();
  324.         }
  325.         else
  326.         {
  327.             $std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
  328.         }
  329.         unset($temp_html);
  330.     
  331.         $this->output .= $this->html->end_all_cats();
  332.     }
  333.     
  334.     
  335.     //*********************************************/
  336.     //
  337.     // PROCESS ALL CATEGORIES
  338.     //
  339.     //*********************************************/
  340.     
  341.     function process_all_cats() {
  342.     
  343.         global $std, $DB, $ibforums;    
  344.         
  345.         foreach ($this->cats as $cat_id => $cat_data)
  346.         {
  347.         
  348.             //----------------------------
  349.             // Is this category turned on?
  350.             //----------------------------
  351.         
  352.             if (! $cat_data['state'] )
  353.             {
  354.                 continue;
  355.             }
  356.         
  357.             foreach ($this->forums as $forum_id => $forum_data)
  358.             {
  359.                 if ($forum_data['category'] == $cat_id)
  360.                 {
  361.                     //-----------------------------------
  362.                     // We store the HTML in a temp var so
  363.                     // we can make sure we have cats for
  364.                     // this forum, or hidden forums with a 
  365.                     // cat will show the cat strip - we don't
  366.                     // want that, no - we don't.
  367.                     //-----------------------------------
  368.                     
  369.                     $temp_html .= $this->process_forum($forum_id, $forum_data);
  370.                 }
  371.             }
  372.             
  373.             if ($temp_html != "")
  374.             {
  375.                 $this->output .= $this->html->CatHeader_Expanded($cat_data);
  376.                 $this->output .= $temp_html;
  377.                 $this->output .= $this->html->end_this_cat();
  378.             }
  379.             
  380.             unset($temp_html);
  381.         }
  382.         
  383.         $this->output .= $this->html->end_all_cats();
  384.         
  385.     }
  386.  
  387.  
  388.     //*********************************************/
  389.     //
  390.     // SHOW A SINGLE CATEGORY
  391.     //
  392.     //*********************************************/   
  393.     
  394.     function show_single_cat() {
  395.     
  396.         global $std, $DB, $ibforums;    
  397.         
  398.         $cat_id = $ibforums->input['c'];
  399.         
  400.         if (!is_array( $this->cats[ $cat_id ] ) )
  401.         {
  402.             $std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
  403.         }
  404.         
  405.         $cat_data = $this->cats[ $cat_id ];
  406.         
  407.         //----------------------------
  408.         // Is this category turned on?
  409.         //----------------------------
  410.         
  411.         if (! $cat_data['state'] )
  412.         {
  413.             $std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
  414.         }
  415.     
  416.         foreach ($this->forums as $forum_id => $forum_data)
  417.         {
  418.             if ($forum_data['category'] == $cat_id)
  419.             {
  420.                 //-----------------------------------
  421.                 // We store the HTML in a temp var so
  422.                 // we can make sure we have cats for
  423.                 // this forum, or hidden forums with a 
  424.                 // cat will show the cat strip - we don't
  425.                 // want that, no - we don't.
  426.                 //-----------------------------------
  427.                 
  428.                 $temp_html .= $this->process_forum($forum_id, $forum_data);
  429.             }
  430.         }
  431.         
  432.         if ($temp_html != "")
  433.         {
  434.             $this->output .= $this->html->CatHeader_Expanded($cat_data);
  435.             $this->output .= $temp_html;
  436.             $this->output .= $this->html->end_this_cat();
  437.         }
  438.         else
  439.         {
  440.             $std->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files' ) );
  441.         }
  442.         unset($temp_html);
  443.     
  444.         $this->output .= $this->html->end_all_cats();
  445.     }
  446.     
  447.     //*********************************************/
  448.     //
  449.     // RENDER A FORUM
  450.     //
  451.     //*********************************************/   
  452.     
  453.     function process_forum($forum_id="", $forum_data="")
  454.     {
  455.         global $std, $ibforums;
  456.         
  457.         
  458.         if ($forum_data['subwrap'] == 1)
  459.         {
  460.         
  461.             $printed_children = 0;
  462.             
  463.             //--------------------------------------
  464.             // This is a sub cat forum...
  465.             //--------------------------------------
  466.             
  467.             // Do we have any sub forums here?
  468.             
  469.             if ( (isset($this->children[ $forum_data['id'] ])) and (count($this->children[ $forum_data['id'] ]) > 0 ) )
  470.             {
  471.             
  472.                 $newest = array();
  473.             
  474.                 foreach($this->children[ $forum_data['id'] ] as $idx => $data)
  475.                 {
  476.                     //--------------------------------------
  477.                     // Check permissions...
  478.                     //--------------------------------------
  479.             
  480.                     if ($data['read_perms'] != '*')
  481.                     {
  482.                         if ( ! preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|$)/", $data['read_perms'] ) )
  483.                         {
  484.                             continue;
  485.                         }
  486.                     }
  487.                     
  488.                     // Do the news stuff first
  489.                     
  490.                     if (isset($data['last_title']) and $data['last_id'] != "")
  491.                     {
  492.                     
  493.                         if ( ( $ibforums->vars['index_news_link'] == 1 ) and (! empty($ibforums->vars['news_forum_id']) ) and ($ibforums->vars['news_forum_id'] == $data['id']) )
  494.                         {
  495.                             
  496.                            $this->news_topic_id = $data['last_id'];
  497.                            $this->news_forum_id = $data['id'];
  498.                            $this->news_title    = $data['last_title'];
  499.                             
  500.                         }
  501.                         
  502.                     }
  503.                     
  504.                     if ($data['last_post'] > $newest['last_post'])
  505.                     {
  506.                         
  507.                         $newest['last_post'] = $data['last_post'];
  508.                         $newest['fid']       = $data['id'];
  509.                         
  510.                         if (strlen($data['last_title']) > 30)
  511.                         {
  512.                             $data['last_title'] = str_replace( "!" , "!", $data['last_title'] );
  513.                             $data['last_title'] = str_replace( """, "\"", $data['last_title'] );
  514.                             $data['last_title'] = substr($data['last_title'],0,27) . "...";
  515.                             $data['last_title'] = preg_replace( '/&(#(\d+;?)?)?\.\.\.$/', '...', $data['last_title'] );
  516.                         }
  517.                         if ($data['password'] != "")
  518.                         {
  519.                             $newest['last_topic'] = $ibforums->lang['f_protected'];
  520.                         }
  521.                         else
  522.                         {
  523.                             $newest['last_topic'] = "<a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}&act=ST&f={$data['id']}&t={$data['last_id']}&view=getlastpost'>{$data['last_title']}</a>";
  524.                         }
  525.                         
  526.                         if ( isset($data['last_poster_name']))
  527.                         {
  528.                             $newest['last_poster'] = $data['last_poster_id'] ? "<a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}&act=Profile&CODE=03&MID={$data['last_poster_id']}'>{$data['last_poster_name']}</a>"
  529.                                                                            : $data['last_poster_name'];
  530.                         }
  531.             
  532.                     }
  533.                     
  534.                     $newest['posts']  += $data['posts'];
  535.                     $newest['topics'] += $data['topics'];
  536.                     $newest['status'] = $data['status'];
  537.                     
  538.                     $printed_children++;
  539.                     
  540.                 }
  541.                 
  542.                 if ($printed_children < 1)
  543.                 {
  544.                     // If we don't have permission to view any forums
  545.                     // then simply return and the row won't be printed
  546.                     
  547.                     return "";
  548.                     
  549.                 }
  550.                 
  551.                 // Fix up the last of the data
  552.                 
  553.                 $newest['img_new_post'] = $this->new_posts($newest, 1);
  554.             
  555.                 $newest['last_post'] = $std->get_date($newest['last_post'], 'LONG');
  556.                 
  557.                 $newest['last_topic']  = $newest['last_topic']  ? $newest['last_topic']  : $ibforums->lang['f_none'];
  558.                 
  559.                 $newest['last_poster'] = $newest['last_poster'] ? $newest['last_poster'] : $ibforums->lang['f_none'];
  560.                 
  561.                 foreach($newest as $k => $v)
  562.                 {
  563.                     $forum_data[$k] = $v;
  564.                 }
  565.                 
  566.                 return $this->html->ForumRow($forum_data);
  567.                 
  568.             }
  569.             else
  570.             {
  571.                 return "";
  572.             }
  573.         
  574.         }
  575.         else
  576.         {
  577.         
  578.             //--------------------------------------
  579.             // Check permissions...
  580.             //--------------------------------------
  581.             
  582.             if ($forum_data['read_perms'] != '*')
  583.             {
  584.                 if ( ! preg_match( "/(^|,)".$ibforums->member['mgroup']."(,|$)/", $forum_data['read_perms'] ) )
  585.                 {
  586.                     return "";
  587.                 }
  588.             }
  589.             
  590.             $forum_data['img_new_post'] = $this->new_posts($forum_data);
  591.             
  592.             $forum_data['last_post'] = $std->get_date($forum_data['last_post'], 'LONG');
  593.                         
  594.             $forum_data['last_topic'] = $ibforums->lang['f_none'];
  595.             
  596.             if (isset($forum_data['last_title']) and $forum_data['last_id'] != "")
  597.             {
  598.             
  599.                 if ( ( $ibforums->vars['index_news_link'] == 1 ) and (! empty($ibforums->vars['news_forum_id']) ) and ($ibforums->vars['news_forum_id'] == $forum_data['id']) )
  600.                 {
  601.                     
  602.                    $this->news_topic_id = $forum_data['last_id'];
  603.                    $this->news_forum_id = $forum_data['id'];
  604.                    $this->news_title    = $forum_data['last_title'];
  605.                     
  606.                 }
  607.                 
  608.                 $forum_data['last_title'] = str_replace( "!" , "!", $forum_data['last_title'] );
  609.                 $forum_data['last_title'] = str_replace( """, "\"", $forum_data['last_title'] );
  610.                 
  611.                     
  612.                 if (strlen($forum_data['last_title']) > 30)
  613.                 {
  614.                     $forum_data['last_title'] = substr($forum_data['last_title'],0,27) . "...";
  615.                     $forum_data['last_title'] = preg_replace( '/&(#(\d+;?)?)?\.\.\.$/', '...', $forum_data['last_title'] );
  616.                 }
  617.                 
  618.                 if ($forum_data['password'] != "")
  619.                 {
  620.                     $forum_data['last_topic'] = $ibforums->lang['f_protected'];
  621.                 }
  622.                 else
  623.                 {
  624.                     $forum_data['last_topic'] = "<a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}&act=ST&f={$forum_data['id']}&t={$forum_data['last_id']}&view=getlastpost'>{$forum_data['last_title']}</a>";
  625.                 }
  626.             }     
  627.                             
  628.             if ( isset($forum_data['last_poster_name']))
  629.             {
  630.                 $forum_data['last_poster'] = $forum_data['last_poster_id'] ? "<a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}&act=Profile&CODE=03&MID={$forum_data['last_poster_id']}'>{$forum_data['last_poster_name']}</a>"
  631.                                                                            : $forum_data['last_poster_name'];
  632.             }
  633.             else
  634.             {
  635.                 $forum_data['last_poster'] = $ibforums->lang['f_none'];
  636.             }
  637.     
  638.             //---------------------------------
  639.             // Moderators
  640.             //---------------------------------
  641.             
  642.             $forum_data['moderator'] = "";
  643.             
  644.             if (isset($this->mods[ $forum_data['id'] ] ) )
  645.             {
  646.                 $forum_data['moderator'] = $ibforums->lang['forum_leader'].' ';
  647.                 
  648.                 if (is_array($this->mods[ $forum_data['id'] ]) )
  649.                 {
  650.                     foreach ($this->mods[ $forum_data['id'] ] as $moderator)
  651.                     {
  652.                         $forum_data['moderator'] .= "<a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}&act=Profile&CODE=03&MID={$moderator['id']}'>{$moderator['name']}</a>, ";
  653.                     }
  654.                     $forum_data['moderator'] = preg_replace( "!,\s+$!", "", $forum_data['moderator'] );
  655.                 }
  656.                 else
  657.                 {
  658.                     $forum_data['moderator'] .= "<a href='{$ibforums->vars['board_url']}/index.{$ibforums->vars['php_ext']}?s={$ibforums->session_id}&act=Profile&CODE=03&MID={$this->mods[$forum_data['id']]['id']}'>{$this->mods[$forum_data['id']]['name']}</a>";
  659.                 }
  660.             }
  661.             
  662.             
  663.             return $this->html->ForumRow($forum_data);
  664.         
  665.         }
  666.                     
  667.     }
  668.     
  669.     
  670.     function new_posts($forum_data, $sub=0) {
  671.         global $ibforums, $std;
  672.         
  673.         $rtime = $ibforums->input['last_visit'];
  674.         
  675.         $fid   = $forum_data['fid'] == "" ? $forum_data['id'] : $forum_data['fid'];
  676.         
  677.         if ( $ftime = $std->my_getcookie('fread_'.$fid ) )
  678.         {
  679.             $rtime = $ftime > $rtime ? $ftime : $rtime;
  680.         }
  681.         
  682.         if ($sub == 0)
  683.         {
  684.             if ( ! $forum_data['status'] )
  685.             {
  686.                 return $ibforums->skin['C_LOCKED'];
  687.             }
  688.             
  689.             $sub_cat_img = '';
  690.         }
  691.         else
  692.         {
  693.             $sub_cat_img = '_CAT';
  694.         }
  695.         
  696.         if ($forum_data['password'] and $sub == 0)
  697.         {
  698.             return $forum_data['last_post'] > $rtime ? $ibforums->skin['C_ON_RES']
  699.                                                      : $ibforums->skin['C_OFF_RES'];
  700.         }
  701.         
  702.         return $forum_data['last_post']  > $rtime ? $ibforums->skin['C_ON'.$sub_cat_img]
  703.                                                   : $ibforums->skin['C_OFF'.$sub_cat_img];
  704.     }
  705.         
  706. }
  707.  
  708. ?>
  709.